package chapter5.section6;

//程序5-14：一个内部类的定义
public class OuterClass {
    private String name;
    private String state;

    public OuterClass(String name, String state) {
        super();
        this.name = name;
        this.state = state;
    }

    public static void main(String[] args) {
        OuterClass outer = new OuterClass("冰箱", "完好");
        OuterClass.InnerClass inner = outer.new InnerClass();
        inner.alarm();
    }

    private void say() {
        System.out.println("外部：" + name + "的状态是" + state);
    }

    public class InnerClass {
        public void alarm() {
            System.out.println("内部：" + name + "的状态是" + state);
            say();
        }
    }
}
